const mysql = require('mysql')

const pool = mysql.createPool({
  host: 'localhost',
  user: 'root',
  password: '3051532wyp.',
  database: 's1709A'
})

function exec(sql) {
  return new Promise((resolve, reject) => {
    pool.query(sql, (err, data) => {
      // console.log(err, 'err')
      if (err) reject(err);
      resolve(data)
    })
  })
}

module.exports = {
  exec
}

